package com.nation.serviceImpl;

import com.nation.dao.ImportantLiteratureDataDao;
import com.nation.domain.TImportantLiteratureData;
import com.nation.service.ImportantLiteratureDataService;
import com.nation.utils.ReadAndStoreFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by 凌 on 2017/11/25.
 */
@Service
public class ImportantLiteratureDataServiceImpl implements ImportantLiteratureDataService {
    @Autowired
    ImportantLiteratureDataDao importantLiteratureDataDao;
    public void uploadLiteratureData(TImportantLiteratureData tImportantLiteratureData){
        String recoderTime= ReadAndStoreFile.getRecoderTime();
        tImportantLiteratureData.setRecoderTime(recoderTime);
        int document_num=importantLiteratureDataDao.getDocumentNum();
        System.out.println("document_num-------------"+document_num);
        String document_code="D"+tImportantLiteratureData.getCountryCode()+tImportantLiteratureData.getDocumentType()+document_num;
        tImportantLiteratureData.setDocumentCode(document_code);
        importantLiteratureDataDao.uploadLiteratureData(tImportantLiteratureData);
    }
}
